package top.infopub.mgr.bpa.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import top.infopub.enums.cap.CapProcessDetailTypeEnum;
import top.infopub.enums.mkt.HistoryProcessStatusTypeEnum;

import java.util.Date;

/*审批信息*/
public class BpaHisProcessDomain {
    /*发起日期*/
    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date startTime;
    /*发起人*/
    private String startRealName;
    /*审批小阶段*/
    private  String flowNode;
    /*审批日期*/
    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date dealTime;
    /*审批人*/
    private String dealName;
    /*审批状态*/
    private String state;
    /*审批流程ID*/
    private String processId;

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public String getStartRealName() {
        return startRealName;
    }

    public void setStartRealName(String startRealName) {
        this.startRealName = startRealName;
    }

    public Date getDealTime() {
        return dealTime;
    }

    public void setDealTime(Date dealTime) {
        this.dealTime = dealTime;
    }

    public String getDealName() {
        return dealName;
    }

    public void setDealName(String dealName) {
        this.dealName = dealName;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
        if (StringUtils.isNotBlank(state)) this.state = HistoryProcessStatusTypeEnum.getByCode(state).getName();
    }

    public String getProcessId() {
        return processId;
    }

    public void setProcessId(String processId) {
        this.processId = processId;
    }

    public String getFlowNode() {
        return flowNode;
    }

    public void setFlowNode(String flowNode) {
        this.flowNode = flowNode;
        if (StringUtils.isNotBlank(flowNode)) this.flowNode = CapProcessDetailTypeEnum.getByNode(flowNode).getNodeName();
    }
}
